import { BaseComponent } from "./BaseComponent";

const { ccclass, property } = cc._decorator;
/**
 * 适配全屏的ui组件
 */
@ccclass
export class BaseFullComponent extends BaseComponent {
    public nodeWidget: cc.Widget;
    protected onLoad() {
        super.onLoad();
        this.nodeWidget = this.node.getComponent(cc.Widget);
        if (!this.nodeWidget) {
            this.nodeWidget = this.node.addComponent(cc.Widget);
            this.nodeWidget.left = this.nodeWidget.right = this.nodeWidget.top = this.nodeWidget.bottom = 0;
        }
    }


    protected start() {
        super.start();
    }

    protected resize(age?): void {
        if (this.nodeWidget) {
            this.nodeWidget.updateAlignment();
        }
    }
}
